﻿<?php
header("content-type:text/html;charset=utf-8");
date_default_timezone_set("PRC");
include("smarty/main.php");  
require_once("../connectMysql/connetMysql.class.php"); 
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_GET['newsid']) && $_GET['newsid'] != ""){
	$newsid=$_GET['newsid'];
	$newstitle="";
	$newscontent="";
	$newsbrowsenumber="";
	$newssubmittime="";
	$newscommentnumber="";

	$db=new connetMysql;
	$con=$db->getConnect();
	//////////查询新闻表
	$sql="SELECT * FROM newsdraft where newsid='".$newsid."'";
	$result = mysqli_query($con,$sql); 
	if($row = mysqli_fetch_array($result)){
		$newstitle=$row["newstitle"];
		$newscontent=$row["newscontent"];
		$newsbrowsenumber=$row["newsbrowsenumber"];	
		$newssubmittime=$row["newssubmittime"];	
		
		/////////查询评论个数
		$sql2="SELECT * FROM comment where commentnewsid='".$newsid."'";
		$result2 = mysqli_query($con,$sql2); 
		$newscommentnumber=mysqli_num_rows($result2);
		
		
		$tpl->assign("current_locat", "当前位置");  
		$tpl->assign("news_title", $newstitle);  
		$tpl->assign("news_fabu_time", $newssubmittime);  
		$tpl->assign("news_fabu_name", "小潘");  
		$tpl->assign("news_comment_canyu", $newsbrowsenumber);  
		$tpl->assign("news_comment_pinglun", $newscommentnumber);  
		$tpl->assign("display_content", $newscontent);

		$tpl->display("display_news.html");
	}
	else{
		echo "页面不存在！";
	}
	
	
	
}             //////////////////结束     if(isset($_GET['newsid']) && $_GET['newsid'] != "")
else{
	echo "页面不存在！";
}
?>